package cn.raven.basic.config;

import cn.raven.basic.interceper.LoginIntercrper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfigurer implements WebMvcConfigurer {
    @Autowired
    private LoginIntercrper loginIntercrper;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercrper)//我们的登录拦截器
                .addPathPatterns("/**") //拦截所有请求
                .excludePathPatterns("/login/**") //配置放行路径
                .excludePathPatterns("/fastDfs/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("/shop/smsCode")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/shop/live");
    }
}
